package eu.news.data.hibernate.pojo;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import eu.news.data.hibernate.pojo.HB_News;
import eu.news.data.pojo.News;
import eu.news.data.pojo.Picture;

@Entity
@Table(name="picture")
public class HB_Picture extends Picture implements java.io.Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1159296143826264289L;

	/**
	 * 代理主键
	 */
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	int id;
	
	/**
	 * 路径
	 */
	@Column(nullable=false,length=200)
	String path;
	
	/**
	 * 缩略图路径
	 */
	@Column(nullable=true,length=200)
	String thumb;
	
	/**
	 * 说明
	 */
	@Column(nullable=true,columnDefinition="text")
	String remark;
	
	/**
	 * 
	 */
	@ManyToOne(cascade=CascadeType.ALL,
			targetEntity=HB_News.class,
			fetch=FetchType.LAZY
		)
	@JoinColumn(name="news_id",nullable=true)
	HB_News news;

	public HB_Picture(){};
	
	public HB_Picture(String path, String remark,News news) {
		super();
		this.path = path;
		this.remark = remark;
		this.news=(HB_News) news;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public News getNews() {
		return news;
	}

	public void setNews(News news) {
		this.news = (HB_News) news;
	}

	public String getThumb() {
		return thumb;
	}

	public void setThumb(String thumb) {
		this.thumb = thumb;
	}
	
}
